﻿<ResourceDictionary 
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
 xmlns:local="clr-namespace:ChoWorkflowDashboard;assembly="
 x:Class="ChoWorkflowDashboard.DataGridResource"
                x:ClassModifier="public">

    <local:TasksActionMenuEnabledByAdminConverter x:Key="TasksActionMenuEnabledByAdminConverter"/>
    <local:TasksActionMenuEnabledConverter x:Key="TasksActionMenuEnabledConverter"/>
    <local:TasksActionMenuEnabledMultiConverter x:Key="TasksActionMenuEnabledMultiConverter"/>
    <!--<Style TargetType="{x:Type MenuItem}">
        <Style.Resources>
            -->
    <!-- override default brushes that show bad background colors -->
    <!--
            <Brush x:Key="{x:Static SystemColors.HighlightBrushKey}">Black</Brush>
            -->
    <!--<Brush x:Key="{x:Static SystemColors.ControlBrushKey}">Red</Brush>-->
    <!--
        </Style.Resources>
        <Setter Property="Background" Value="Gray"></Setter>
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="FontSize" Value="13"></Setter>
        <Setter Property="FontFamily" Value="Verdana"></Setter>
        <Setter Property="Margin" Value="-5,0,0,0"></Setter>
        <Style.Triggers>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Background" Value="Black"></Setter>
                <Setter Property="FontSize" Value="13"></Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="LightGray"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>-->
    <!-- the context menu for the tree -->
    <ContextMenu x:Key="TasksActionMenu" >
        <MenuItem Click="OnStartTask" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},Path=PlacementTarget.SelectedItem}"
                  >
            <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource TasksActionMenuEnabledMultiConverter}">
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledByAdminConverter}" ConverterParameter="Start" />
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledConverter}" ConverterParameter="Start" />
                </MultiBinding>
            </MenuItem.IsEnabled>
            <MenuItem.Header>
                <TextBlock Text="Start" VerticalAlignment="Center" />
            </MenuItem.Header>
            <MenuItem.Icon>
                <Border Padding="2">
                    <Image Source="/Images/Start.ico" Width="16" Height="16" />
                </Border>
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Click="OnResumeTask" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},Path=PlacementTarget.SelectedItem}"
                  >
            <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource TasksActionMenuEnabledMultiConverter}">
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledByAdminConverter}" ConverterParameter="Resume" />
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledConverter}" ConverterParameter="Resume" />
                </MultiBinding>
            </MenuItem.IsEnabled>
            <MenuItem.Header>
                <TextBlock Text="Resume" VerticalAlignment="Center" />
            </MenuItem.Header>
            <MenuItem.Icon>
                <Border Padding="2">
                    <Image Source="/Images/Resume.ico" Width="16" Height="16" />
                </Border>
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Click="OnStopTask" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},Path=PlacementTarget.SelectedItem}" >
            <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource TasksActionMenuEnabledMultiConverter}">
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledByAdminConverter}" ConverterParameter="Stop" />
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledConverter}" ConverterParameter="Stop" />
                </MultiBinding>
            </MenuItem.IsEnabled>
            <MenuItem.Header>
                <TextBlock Text="Stop" VerticalAlignment="Center" />
            </MenuItem.Header>
            <MenuItem.Icon>
                <Border Padding="2">
                    <Image Source="/Images/Stop.ico" Width="16" Height="16" />
                </Border>
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Click="OnAbortTask" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},Path=PlacementTarget.SelectedItem}">
            <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource TasksActionMenuEnabledMultiConverter}">
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledByAdminConverter}" ConverterParameter="Abort" />
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledConverter}" ConverterParameter="Abort" />
                </MultiBinding>
            </MenuItem.IsEnabled>
            <MenuItem.Header>
                <TextBlock Text="Abort" VerticalAlignment="Center" />
            </MenuItem.Header>
            <MenuItem.Icon>
                <Border Padding="2">
                    <Image Source="/Images/Abort.ico" Width="16" Height="16" />
                </Border>
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Click="OnActivateTask" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},Path=PlacementTarget.SelectedItem}">
            <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource TasksActionMenuEnabledMultiConverter}">
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledByAdminConverter}" ConverterParameter="Activate" />
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledConverter}" ConverterParameter="Activate" />
                </MultiBinding>
            </MenuItem.IsEnabled>
            <MenuItem.Header>
                <TextBlock Text="Activate" VerticalAlignment="Center" />
            </MenuItem.Header>
            <MenuItem.Icon>
                <Border Padding="2">
                    <Image Source="/Images/Activate.ico" Width="16" Height="16" />
                </Border>
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Click="OnInactivateTask" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},Path=PlacementTarget.SelectedItem}" >
            <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource TasksActionMenuEnabledMultiConverter}">
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledByAdminConverter}" ConverterParameter="Inactivate" />
                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type ContextMenu}}" Path="PlacementTarget.SelectedItem" Converter="{StaticResource TasksActionMenuEnabledConverter}" ConverterParameter="Inactivate" />
                </MultiBinding>
            </MenuItem.IsEnabled>
            <MenuItem.Header>
                <TextBlock Text="Inactivate" VerticalAlignment="Center" />
            </MenuItem.Header>
            <MenuItem.Icon>
                <Border Padding="2">
                    <Image Source="/Images/Inactivate.ico" Width="16" Height="16" />
                </Border>
            </MenuItem.Icon>
        </MenuItem>
    </ContextMenu>

    <!-- the background of the main window -->
    <LinearGradientBrush x:Key="WindowBrush"
                       EndPoint="0.5,1"
                       StartPoint="0.5,0">
        <GradientStop Color="#FFFAFAFA"
                  Offset="0.382" />
        <GradientStop Color="#FF405159"
                  Offset="0" />
        <GradientStop Color="#FF2D3539"
                  Offset="1" />
        <GradientStop Color="#FFDBDDDD"
                  Offset="0.592" />
        <GradientStop Color="#FFA6AAAB"
                  Offset="0.803" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridBackground" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="Gray" Offset="0" />
        <GradientStop Color="Gray" Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridHeaderBackground" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FF1C7CB1" Offset="0" />
        <GradientStop Color="#FF004A83" Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridHeaderMouseOverBackground" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FF1C7CAF" Offset="0" />
        <GradientStop Color="#FF042A68" Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridHeaderBorder" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FF1B577E" Offset="0" />
        <GradientStop Color="#FF083258" Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridHeaderSortedBorder" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#B58801" Offset="0" />
        <GradientStop Color="#681900" Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridHeaderSortedBackground" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#C46007" Offset="0" />
        <GradientStop Color="#AF2600" Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridSelected" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF3E4854" Offset="1"/>
        <GradientStop Color="#FF5D6670"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="Brush_DataGridMouseOverSelected" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#AF3E4854" Offset="1"/>
        <GradientStop Color="#BF5D6670"/>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="Brush_DataGridSelectedForeground" Color="MidnightBlue" />
    <SolidColorBrush x:Key="Brush_DataGridMouseOverForeground" Color="#FFFFF0" />

    <LinearGradientBrush x:Key="Brush_DataGridAltRowBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFE1FFEE" Offset="0"/>
        <GradientStop Color="#FFC3F9DA" Offset="0.992"/>
    </LinearGradientBrush>

    <Style x:Key="Style_HeaderGripper" TargetType="{x:Type Thumb}">
        <Setter Property="Width" Value="8"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Cursor" Value="SizeWE"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="MinWidth" Value="0" />
        <Setter Property="MinHeight" Value="28" />
        <Setter Property="Foreground" Value="GhostWhite" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <!--<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1" Background="{StaticResource Brush_DataGridHeaderSortedBackground}" BorderBrush="{StaticResource Brush_DataGridHeaderSortedBorder}" Grid.ColumnSpan="2" />-->
                        <ContentPresenter Margin="6,3,6,3" VerticalAlignment="Center" />
                        <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" Grid.Column="1" Width="8" Height="6" Fill="White" Margin="0,0,8,0" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.4" />
                        <Rectangle Width="1" Fill="#AAC377" HorizontalAlignment="Right" Grid.ColumnSpan="2" />
                        <Rectangle Width="1" Margin="0,0,1,0" Fill="#425B10" HorizontalAlignment="Right" Grid.ColumnSpan="2" />
                        <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource Style_HeaderGripper}"/>
                        <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource Style_HeaderGripper}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <!--<Trigger Property="SortDirection" Value="{x:Null}">
                            <Setter TargetName="BackgroundBorder" Property="Background" Value="Transparent" />
                            <Setter TargetName="BackgroundBorder" Property="BorderBrush"  Value="Transparent" />
                        </Trigger>-->
                        <!--<Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="BackgroundBorder" Property="Background" Value="{StaticResource Brush_DataGridHeaderMouseOverBackground}" />
                            <Setter TargetName="BackgroundBorder" Property="BorderBrush" Value="{StaticResource Brush_DataGridHeaderBorder}" />
                        </Trigger>-->
                        <Trigger Property="SortDirection" Value="Ascending">
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                            <Setter TargetName="SortArrow" Property="RenderTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="180" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="SortDirection" Value="Descending">
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="DisplayIndex" Value="0">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_LeftHeaderGripper"></Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type DataGridCell}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border x:Name="BackgroundBorder" Background="Transparent">
                        <ContentControl Content="{TemplateBinding Content}">
                            <ContentControl.ContentTemplate>
                                <DataTemplate>
                                    <TextBlock Background="Transparent" TextWrapping="WrapWithOverflow"
                                               Height="Auto" 
                                               Width="Auto" Text="{Binding Text}" Margin="4,4,6,4"/>
                                </DataTemplate>
                            </ContentControl.ContentTemplate>
                        </ContentControl>
                        <!--ContentPresenter VerticalAlignment="Center" Margin="4,4,6,4" /-->
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" Value="{x:Null}"/>
    </Style>

    <!-- DataGridRow -->

    <Style x:Key="{x:Type DataGridRow}" TargetType="{x:Type DataGridRow}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRow}">
                    <Border x:Name="DGR_Border"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Background="{TemplateBinding Background}"
                        SnapsToDevicePixels="True"
                        >
                        <SelectiveScrollingGrid>
                            <SelectiveScrollingGrid.ColumnDefinitions>
                                <ColumnDefinition Width="1" />
                                <ColumnDefinition Width="*" />
                            </SelectiveScrollingGrid.ColumnDefinitions>
                            <SelectiveScrollingGrid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </SelectiveScrollingGrid.RowDefinitions>
                            <DataGridCellsPresenter Grid.Column="1"
                                                ItemsPanel="{TemplateBinding ItemsPanel}"
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            <DataGridDetailsPresenter x:Name="dataGridDetailsPresenter" Grid.Column="1"
                                                  Grid.Row="1" 
                                                  SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                                                  Visibility="{TemplateBinding DetailsVisibility}" />
                            <DataGridRowHeader x:Name="dataGridRowHeader" Grid.RowSpan="2"
                                           SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
                                           Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                        </SelectiveScrollingGrid>
                    </Border>
                    <!--<Border 
                          x:Name="DGR_Border"
                          Background="{TemplateBinding Background}"
                          BorderBrush="{TemplateBinding BorderBrush}"
                          BorderThickness="{TemplateBinding BorderThickness}"
                          SnapsToDevicePixels="True">
                        <SelectiveScrollingGrid x:Name="selectiveScrollingGrid">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <DataGridCellsPresenter x:Name="dataGridCellsPresenter" 
                                  Grid.Column="1"
                                   ItemsPanel="{TemplateBinding ItemsPanel}"
                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            <DataGridRowHeader x:Name="dataGridRowHeader" 
                                  SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"  
                                  Grid.RowSpan="2"
                                  Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Column}}"/>
                            <Grid Grid.Column="1" Grid.Row="1" Name="Details" Visibility="Collapsed" Background="Gray">
                                <DataGridDetailsPresenter x:Name="dataGridDetailsPresenter" />
                            </Grid>
                        </SelectiveScrollingGrid>
                    </Border>-->
                    <ControlTemplate.Triggers>
                        <!--UNAVAILABLE-->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="0">
                            <Setter Property="Background" Value="DarkSlateGray"/>
                            <Setter Property="Foreground" Value="White"/>
                        </DataTrigger>
                        <!--INACTIVE -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="1">
                            <Setter Property="Background" Value="Gray"/>
                            <Setter Property="Foreground" Value="Black"/>
                        </DataTrigger>
                        <!--ACTIVE -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="2">
                            <Setter Property="Background" Value="Teal"/>
                            <Setter Property="Foreground" Value="Black"/>
                        </DataTrigger>
                        <!--RUNNING -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="3">
                            <Setter Property="Background" Value="Gold"/>
                            <Setter Property="Foreground" Value="Black"/>
                        </DataTrigger>
                        <!--SUCCESS -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="4">
                            <Setter Property="Background" Value="DarkGreen"/>
                            <Setter Property="Foreground" Value="White"/>
                        </DataTrigger>
                        <!--FAILED -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="5">
                            <Setter Property="Background" Value="Red"/>
                            <Setter Property="Foreground" Value="White"/>
                        </DataTrigger>
                        <!--STOPPED -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="6">
                            <Setter Property="Background" Value="Blue"/>
                            <Setter Property="Foreground" Value="White"/>
                        </DataTrigger>
                        <!--ABORTED -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="7">
                            <Setter Property="Background" Value="Navy"/>
                            <Setter Property="Foreground" Value="White"/>
                        </DataTrigger>
                        <!--TIMEDOUT -->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="8">
                            <Setter Property="Background" Value="Black"/>
                            <Setter Property="Foreground" Value="White"/>
                        </DataTrigger>
                        <!--SCHEDULED-->
                        <DataTrigger Binding="{Binding Path=TASK_STATUS}" Value="9">
                            <Setter Property="Background" Value="Brown"/>
                            <Setter Property="Foreground" Value="White"/>
                        </DataTrigger>

                        <!--<Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" TargetName="DGR_Border" Value="{DynamicResource Brush_DataGridMouseOverSelected}"/>
                            <Setter Property="Foreground" TargetName="dataGridCellsPresenter" Value="White"/>
                            <Setter Property="Foreground" TargetName="dataGridRowHeader" Value="White"/>
                            <Setter Property="FontSize" TargetName="dataGridRowHeader" Value="13.333"/>
                        </Trigger>-->
                        <Trigger Property="IsSelected" Value="True">
                            <!--<Setter Property="TextElement.Foreground" TargetName="DGR_Border" Value="{StaticResource Brush_DataGridSelectedForeground}" />-->
                            <!--<Setter Property="Visibility" TargetName="dataGridDetailsPresenter" Value="Hidden"/>-->
                            <Setter Property="FontSize" TargetName="dataGridRowHeader" Value="13.333"/>
                            <Setter Property="TextElement.FontWeight" TargetName="DGR_Border" Value="ExtraBold"/>
                            <!--<Setter Property="Background" TargetName="DGR_Border" Value="{DynamicResource Brush_DataGridSelected}"/>-->
                        </Trigger>


                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DataGrid -->

    <Style x:Key="{x:Type DataGrid}" TargetType="{x:Type DataGrid}">
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="AlternatingRowBackground" Value="{StaticResource Brush_DataGridAltRowBackground}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="#FFA6AAAB" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGrid}">
                    <Border Background="{TemplateBinding Background}">
                        <ScrollViewer Focusable="false" Name="DG_ScrollViewer">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="1"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Border Grid.ColumnSpan="3" Background="{StaticResource Brush_DataGridHeaderBackground}" BorderBrush="{StaticResource Brush_DataGridHeaderBorder}" BorderThickness="0,1" />
                                        <Button/>
                                        <DataGridColumnHeadersPresenter 
                    Grid.Column="1"                       
                                            FontWeight="ExtraBold"
                    Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Column}}"/>
                                        <!-- JAIMER removed from above
                    SourceScrollViewerName="DG_ScrollViewer" -->
                                        <ScrollContentPresenter Grid.Row="1" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" />
                                        <ScrollBar 
                    Name="PART_VerticalScrollBar"
                    Grid.Row="1" 
                    Grid.Column="2" 
                     Orientation="Vertical"
                     Maximum="{TemplateBinding ScrollableHeight}"
                     ViewportSize="{TemplateBinding ViewportHeight}"
                     Value="{Binding Path=VerticalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                     Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                                        <Grid Grid.Row="2" Grid.Column="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=NonFrozenColumnsViewportHorizontalOffset}"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <ScrollBar 
                      Grid.Column="1"
                      Name="PART_HorizontalScrollBar"
                      Orientation="Horizontal"
                      Maximum="{TemplateBinding ScrollableWidth}"
                      ViewportSize="{TemplateBinding ViewportWidth}"
                      Value="{Binding Path=HorizontalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                      Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </ScrollViewer.Template>
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsGrouping" Value="true">
                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Value="{StaticResource Brush_DataGridBackground}" Property="Background" />
                <Setter Value="{StaticResource Brush_DataGridBackground}" Property="Foreground" />
                <!--<Setter TargetName="ScrollViewer" Property="Background" Value="Blue"/>-->
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>